
#
a = 10
def func():
    print(a)

func()

def func2():
    pass

def func3():
    def func4():
        pass
    def func5():
        print('func5')
    print(func5)
    return func5

b = func3()
print(b)
b()

def func7(any_func):
    any_func()

def func8():
    print('func8111')

func7(func8)

a = 10
b = 20
def func9():
    # 函数内部可以修改全局变量
    global a
    a = 100
    b = 200
    print(a)
    print(b)

func9()

print(a)
print(b)

def func10():
    q = 10
    def func11():
        # 在局部作用域向外找一层, 有就引入,没有就再向上找一层
        nonlocal q
        q = 100
        print(q)
    func11()

func10()

